import { getAddressList } from "@/services/index";
let address = {
    namespaced: true,
    state: {
        addressList: [], //地址列表
    },
    mutations: {
        // 封装公共更新数据方法
        update(state, payload) {
            for (let key in payload) {
                state[key] = payload[key];
            }
        },
    },
    actions: {
        // 异步获取地址列表
        async getAddressList({ commit }) {
            let result = await getAddressList();
            if (result) {
                commit("update", { addressList: result });
            }
        },
    },
    modules: {},
};

export default address;
